{% extends "base.html" %}
{% block content %}

{% if demands%}
{% for demand in demands%}
<div class="house-title">
    <h1 class="c_333 f20">{{demand.title}}</h1>
    <p class="c_888 f12">{{demand.date}}发布</p>
    {% if current_user.role_id == 1 or current_user.id == demand.author_id %}
    <div class="title-right-info">
        <a class="btn btn-app" href="/bd/view_demand?id={{demand.id}}"><i class="fa fa-edit"></i> 编辑</a>
        <a class="btn btn-app" id="delete" value="{{demand.id}}"><i class="fa fa-trash-o"></i> 删除</a>
    </div>
    {% endif %}
</div>
<br>
<div class="main_tab list_01">
    <ul style="list-style-type:none">
        <li><i class="c_888">区域：</i>{{demand.area.name}}&nbsp;</li>
        <li><i class="c_888">居室：</i>{{demand.mode.name}}</li>
        <li><i class="c_888">租金：</i><em class="redfont">{{demand.price_low}}-{{demand.price_high}}元/月</em> </li>
        <li><i class="c_888">联系人：</i>{{demand.contacts}}</li>
        <li><i class="c_888">联系方式：</i>{{demand.phone_number}}</li>
    </ul>
</div>
<br>
<div class="submenu">
    <a href="#" class="sub-on">所有问题</a>
</div>
<div class="main_tab list_01">
    <h3 class="c_888">描述：</h3>
    <span class="c_888">{{demand.description}}</span>
</div>

{% endfor %}
{% endif %}
{% endblock %}
{% block script %}
<script>
    $(function(){
        $("#delete").click(function(){
            $.ajax({
                type : "get",
                url : "/bd/my_demand_publish",
                cache:false,
                data : {'delete_demand_id':$("#delete").attr("value")},
                dataType : "String"
            });
        });
    });
</script>
<script>
    $(function(){
        $("#delete").click(function(){
            alert("删除成功")
        });
    });
</script>
<script>
    $('#delete').click(function() {
        window.location.href = 'http://127.0.0.1:5000/bd/my_rent_publish';
    });
</script>
{% endblock %}